<template>
	<view class="page page-order">
		<!-- 列表 -->
		<view class="prescript-list">
			<LoadMore ref="LoadMore" id="LoadMore" :diffHeight="72" :initData="initData" @dataRefresh='dataRefresh'>
				<block v-for="(item, index) in dataList" :key="index">
					<view class="item" @click="goNext('/pagesA/prescript/myOrderDetail?id=' + item.id)">
						<view class="part1 flex-row-between">
							<view class="font13">诊断结果：{{item.diagnose ? item.diagnose : '暂无'}}</view>
						</view>
						<view class="part2">
							<text class="font13">用药建议：</text>
							<!-- 此处最多展示2个药品 -->
							<block v-for="(drug, i) in item.goods_list" :key="i">
								<view v-if="i < 2" class="font12 font-969696">
									<text>{{drug.goods_name}} {{drug.spec_name}} *{{drug.number}}</text>
									<text v-if="i == 1">...</text>
								</view>
							</block>
						</view>
						<view class="doctor font12 font-969696 flex-row-start">
							<view class="photo bg-cover" :style="{backgroundImage: 'url(' + (item.doctor_info?item.doctor_info.img:'') + ')'}"></view>
							<text>{{item.doctor_info?item.doctor_info.name:''}}</text>
							<text>{{item.createtime}}</text>
						</view>
						<uni-icons class="icon" type="arrowright" size="14" color="#969696"></uni-icons>
					</view>
				</block>
			</LoadMore>
		</view>
	</view>
</template>

<script>
	import LoadMore from "@/components/loadMore.vue";
	export default {
		components: { LoadMore },
		data() {
			return {
				filterCurrent: '', // 高亮的id
				// 传参数据
				initData: {
					url: 'mylistPrescription',
					param: {
						status: 'yes'
					}
				},
				dataList:[],
			}
		},
		methods: {
			//返回数据
			dataRefresh(e) {
				let $this = this
				e.forEach(item => {
					if (item.doctor_info) {
						item.doctor_info.img = $this.$store.state.http_img + item.doctor_info.img
					}
				})
				this.dataList = e
			},
			goNext (url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
</style>
